package com.qiuyuliantu.base.controller;

import java.util.List;
import java.util.Properties;
import javax.mail.Message;
import javax.mail.NoSuchProviderException;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;
import javax.servlet.http.HttpServletResponse;


import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.qiuyuliantu.common.annotation.Log;
import com.qiuyuliantu.common.core.controller.BaseController;
import com.qiuyuliantu.common.core.domain.AjaxResult;
import com.qiuyuliantu.common.enums.BusinessType;
import com.qiuyuliantu.base.domain.QiuAnniversaryReminders;
import com.qiuyuliantu.base.service.IQiuAnniversaryRemindersService;
import com.qiuyuliantu.common.utils.poi.ExcelUtil;
import com.qiuyuliantu.common.core.page.TableDataInfo;

/**
 * 纪念日提醒Controller
 *
 * @author 卷卷
 * @date 2024-11-19
 */
@RestController
@RequestMapping("/base/reminders")
public class QiuAnniversaryRemindersController extends BaseController
{
    @Autowired
    private IQiuAnniversaryRemindersService qiuAnniversaryRemindersService;

    /**
     * 查询纪念日提醒列表
     */
    @PreAuthorize("@ss.hasPermi('base:reminders:list')")
    @GetMapping("/list")
    public TableDataInfo list(QiuAnniversaryReminders qiuAnniversaryReminders)
    {

        startPage();
        List<QiuAnniversaryReminders> list = qiuAnniversaryRemindersService.selectQiuAnniversaryRemindersList(qiuAnniversaryReminders);
        return getDataTable(list);
    }

    /**
     * 导出纪念日提醒列表
     */
    @PreAuthorize("@ss.hasPermi('base:reminders:export')")
    @Log(title = "纪念日提醒", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, QiuAnniversaryReminders qiuAnniversaryReminders)
    {
        List<QiuAnniversaryReminders> list = qiuAnniversaryRemindersService.selectQiuAnniversaryRemindersList(qiuAnniversaryReminders);
        ExcelUtil<QiuAnniversaryReminders> util = new ExcelUtil<QiuAnniversaryReminders>(QiuAnniversaryReminders.class);
        util.exportExcel(response, list, "纪念日提醒数据");
    }

    /**
     * 获取纪念日提醒详细信息
     */
    @PreAuthorize("@ss.hasPermi('base:reminders:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(qiuAnniversaryRemindersService.selectQiuAnniversaryRemindersById(id));
    }

    /**
     * 新增纪念日提醒
     */
    @PreAuthorize("@ss.hasPermi('base:reminders:add')")
    @Log(title = "纪念日提醒", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody QiuAnniversaryReminders qiuAnniversaryReminders)
    {
        return toAjax(qiuAnniversaryRemindersService.insertQiuAnniversaryReminders(qiuAnniversaryReminders));
    }

    /**
     * 修改纪念日提醒
     */
    @PreAuthorize("@ss.hasPermi('base:reminders:edit')")
    @Log(title = "纪念日提醒", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody QiuAnniversaryReminders qiuAnniversaryReminders)
    {
        return toAjax(qiuAnniversaryRemindersService.updateQiuAnniversaryReminders(qiuAnniversaryReminders));
    }

    /**
     * 删除纪念日提醒
     */
    @PreAuthorize("@ss.hasPermi('base:reminders:remove')")
    @Log(title = "纪念日提醒", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(qiuAnniversaryRemindersService.deleteQiuAnniversaryRemindersByIds(ids));
    }

}
